package com.example.neusoftfood_c213_zhong.model;



import com.example.neusoftfood_c213_zhong.activity.LoginActivity;
import com.example.neusoftfood_c213_zhong.common.Constants;
import com.example.neusoftfood_c213_zhong.listener.RetrofitListener;
import com.example.neusoftfood_c213_zhong.service.UserService;

import retrofit2.Call;

public class UserModel  extends RetrofitBaseModel {
    private UserService userService;


    public UserModel() {
        this.userService = retrofit.create(UserService.class);
    }
    public void userLogin(String username, String password, final LoginActivity listener)  {
        Call call=userService.login(username, password);
        bindCallback(call,listener, Constants.USERLOGIN);
    }
    public void register(String username, String userpass, String mobilenum,
                         String address, String comment, final RetrofitListener listener) {
        Call call = userService.register(username, userpass, mobilenum, address, comment);
        bindCallback(call,listener, Constants.USEREGISTER);
    }

    public void userCollectFood(String user_id, int food_id, final RetrofitListener listener) {
        Call call = userService.userCollectFood(user_id,food_id);
        bindCallback(call,listener,Constants.USERCOLLECTFOOD);
    }

    public void getAllUserCollection(String user_id,String flag,final RetrofitListener listener){
        Call call = userService.getAllUserCollection(user_id,flag);
        bindCallback(call,listener,Constants.GETALLUSERCOLLECTION);

    }


}

